<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>我的信息</title>
    <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
    <link rel="stylesheet" href="/js/bootstrap-4.1.1-dist/css/bootstrap.min.css">
    <script src="/js/jquery/jquery.min.js"></script>
    <script src="/js/bootstrap-4.1.1-dist/js/bootstrap.min.js"></script>
    <link rel="stylesheet" href="/css/font/css/font-awesome.min.css"/>
    <link rel="stylesheet" href="/css/reset.css"/>
    <link rel="stylesheet" href="/css/message.css"/>
    <script src="/js/plugins/jrender/jrender.min.js"></script>
    <link rel="stylesheet" href="/js/plugins/dialog2/dialog.css"/>
    <script src="/js/plugins/dialog2/dialog.min.js"></script>
    <script src="/js/common.js"></script>
    <script src="/js/checkLogin.js"></script>

    <style type="text/css">
        .size{
            color:black;
            font-size: 10px;
            font-style: revert;
        }
    </style>
    <script>
        $(function () {
            $.get(baseUrl + "/users/chatSet/" + user.id, function (data) {
                console.log(data);
                $.each(data, function (index, value) {
                    if (value.unreadNum == 0) {
                        value.unreadNum = null;
                    }
                })
                var json = {
                    list: data
                }
                $("#receivers").renderValues(json, {
                    getHref: function (item, value) {
                        var url = $(item).data("href");
                        $(item).attr("href", url + value);
                    }
                });

                var num = $('.unreadMessage').html();
                console.log(num);
            });
        });
    </script>
</head>
<body>
<div class="search-head">
    <div class="row nav-search">
        <div class="col">
            <a href="javascript:window.history.go(-1);">
                <span><i class="fa fa-chevron-left"></i></span>
            </a>
        </div>
        <div class="col">
            <span>我的私信</span>
        </div>
        <div class="col"></div>
    </div>
</div>
<div id="receivers">
    <div render-loop="list">
        <ul class="list-group">
            <a data-href="/mine/chats.html?receiverId=" render-key="list.id" render-fun="getHref">
                <li class="list-group-item d-flex justify-content-between align-items-center">
                    <div class="item row">
                        <div class="col-1">
                            <img render-src="list.headImgUrl" width="40px"/>
                        </div>
                        <div class="col-2">
                            <span class="badge badge-danger badge-pill unreadMessage"
                                  render-html="list.unreadNum"></span>
                        </div>
                        <div class="col-8">
                          <strong> <span render-html="list.nickName" ></span></strong>
                            <div render-html="list.chatMessage.content" class="size"></div>
                        </div>
                        <div class="col-2">
                            <div render-html="list.chatMessage.timeString" class="size"></div>
                        </div>
                    </div>
                </li>
            </a>
        </ul>
    </div>
</div>
</body>
</html>